import { Component } from '@nestjs/common';
import { ElasticDto } from '../dto/elasticsearch.dto';
// import { Observable } from 'rxjs/Rx';

@Component()
export class ElasticService {
  constructor(private readonly elasticDto: ElasticDto) {}

  getLastestByPage(from?: number, size?: number) {
    return this.elasticDto.getLastestByPage(from, size);
  }

  getHotestByPage(from?: number, size?: number) {
    return this.elasticDto.getHotestByPage(from, size);
  }

  getByCategory(type: string, sortType?: string, from?: number, size?: number) {
    return this.elasticDto.getByCategory(type, sortType, from, size);
  }

  searchByKeyword(keyword: string) {
    return this.elasticDto.searchByKeyword(keyword);
  }

  getOneById(id: string) {
    return this.elasticDto.getOneById(id);
  }

  getCoursels() {
    return this.elasticDto.getCoursels();
  }

  specialSearch(query: string) {
    return this.elasticDto.specialSearch(query);
  }

  proxyQuery(data: any) {
    return this.elasticDto.proxyQuery(data);
  }

  wordAnalyze(text: string) {
    return this.elasticDto.wordAnalyze(text);
  }
}
